import vue from '@vitejs/plugin-vue'
import { createHtmlPlugin } from 'vite-plugin-html'

import createAutoImport from './auto-import'
import createSvgIcon from './svg-icon'
import createCompression from './compression'
import createSetupExtend from './setup-extend'
import createSupermapBabelPluginImport from './map'

export default function createVitePlugins(viteEnv, isBuild = false) {
    const vitePlugins = [vue(), 
        createHtmlPlugin({
            inject: {
                data: {
                    title: viteEnv.VITE_APP_TITLE
                }
            }
        })
    ]
    vitePlugins.push(createAutoImport())
    vitePlugins.push(createSetupExtend())
    vitePlugins.push(createSvgIcon(isBuild))
    isBuild && vitePlugins.push(...createCompression(viteEnv))
    //超图地图配置
    vitePlugins.push(createSupermapBabelPluginImport);
    return vitePlugins
}
